/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-02-12
 * Time: 15:02
 */
public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param S string字符串
     * @param T string字符串
     * @return bool布尔型
     */
    public boolean isSubsequence (String S, String T) {
        int sl = S.length();
        int tl = T.length();
        if (sl > tl) {
            return false;
        }
        int i = 0;
        int j = 0;
        while (i < sl && j < tl) {
            while (i < sl && j < tl && S.charAt(i) == T.charAt(j)) {
                i++;
                j++;
            }
            j++;
        }
        if (i == sl) {
            return true;
        }
        return false;
    }
}
